package com.gitee.melin.bee.core.jdbc.dialect.starrocks;

import com.gitee.melin.bee.core.jdbc.dialect.mysql.MySqlJdbcDialect;
import com.gitee.melin.bee.core.jdbc.enums.DataSourceType;
import com.gitee.melin.bee.core.jdbc.relational.ConnectionInfo;
import com.gitee.melin.bee.core.jdbc.dialect.DataTypeConvertor;
import com.gitee.melin.bee.core.jdbc.dialect.IDBQuery;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.sql.Connection;

public class StarRocksJdbcDialect extends MySqlJdbcDialect {

    @Override
    public DataSourceType getDataSourceType() {
        return DataSourceType.STARROCKS;
    }

    private static final Logger LOG = LoggerFactory.getLogger(StarRocksJdbcDialect.class);

    public StarRocksJdbcDialect(ConnectionInfo connectionInfo) {
        super(connectionInfo);
    }

    public StarRocksJdbcDialect(Connection connection) {
        super(connection);
    }

    @Override
    protected IDBQuery getDBQuery() {
        return new StarRocksQuery();
    }

    @Override
    protected DataTypeConvertor getTypeConvert() {
        return new StarRocksTypeConvertor();
    }

    @Override
    protected boolean filterSchema(String schemaName) {
        if (schemaName.equalsIgnoreCase("_statistics_")
                || schemaName.equalsIgnoreCase("meta_model")) {
            return false;
        }
        return super.filterSchema(schemaName);
    }
}
